import 'package:enterprise_v6_app/app/components/custom_modele/custom_dropdown_selection.dart';
import 'package:enterprise_v6_app/app/components/toast_widget.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/widget_extension.dart';

/// 智慧仓库通用组件
class CommonWarehouseWidget {
  /// 获取未开始连接时的样式
  static Widget getUnConnectionWidget({
    String? warehouseName,
    Function()? onFirstFunction,
    Function()? onSecondFunction,
    int type = 0,
  }) {
    return Column(
      children: [
        CustomDropdownSelection(
          height: 32.w,
          hintText: '请选择仓库',
          text: warehouseName,
          onCallBack: () {
            if (onFirstFunction != null) {
              onFirstFunction();
            }
          },
        ),
        AppGaps.vGap16,
        Container(
          height: 32.w,
          decoration: BoxDecoration(
              color: warehouseName == null ? const Color(0xff5C6DFF).withOpacity(0.5) : const Color(0xff5C6DFF),
              borderRadius: BorderRadius.all(Radius.circular(8.w))),
          alignment: Alignment.center,
          child: Text(
            '开始${type == 0 ? '入库' : '出库'}',
            style: TextStyle(color: Colors.white, fontSize: 14.sp, fontWeight: FontWeight.w500),
          ),
        ).clickOnce(() {
          if (warehouseName == null) {
            AppToast.showWarning('请先选择仓库');
            return;
          }
          if (onSecondFunction != null) {
            onSecondFunction();
          }
        }),
      ],
    );
  }
}
